package com.app.micaihu.view.home.original.adapter

import com.app.micaihu.bean.news.NewsEntity
import com.app.micaihu.view.army.adapter.ArmyMessageListAdapter
import com.app.micaihu.view.home.original.adapter.provider.AdToutiaoProvider
import com.app.micaihu.view.home.original.adapter.provider.GoneProvider
import com.app.micaihu.view.home.original.adapter.provider.OriginalVideoProvider
import com.chad.library.adapter.base.BaseProviderMultiAdapter
import com.chad.library.adapter.base.module.LoadMoreModule

class OriginalListAdapter : BaseProviderMultiAdapter<NewsEntity>(), LoadMoreModule {
    companion object {
        const val itemGone = 0// 默认
        const val itemVideo = 1//
        const val itemToutiao = 2//
    }

    init {
        //列表 状态0等待通过，1已通过，2拒绝，3退出
        addItemProvider(OriginalVideoProvider())
        addItemProvider(AdToutiaoProvider())
        addItemProvider(GoneProvider())
    }

    override fun getItemType(data: List<NewsEntity>, position: Int): Int {
        val item = data[position]
        return when {
            item.nativeAd != null -> {
                itemToutiao
            }
            item.nativeAd == null -> {
                itemVideo
            }
            else -> {
                itemGone
            }
        }
    }


}